//
//  CPSCAll2CategoryRightBannerView.m
//  CollTest
//
//  Created by codew on 11/10/21.
//

#import "CPSCAll2CategoryRightBannerView.h"
#import "DGGCCycleAdView.h"

@interface CPSCAll2CategoryRightBannerView ()

@property (weak, nonatomic) IBOutlet UIView *viewBannerSuper;
@property(nonatomic, strong) DGGCCycleAdView *advView;

@end

@implementation CPSCAll2CategoryRightBannerView


+ (instancetype)viewBanner
{
    CPSCAll2CategoryRightBannerView *view = [[[NSBundle mainBundle] loadNibNamed:@"CPSCAll2CategoryRightBannerView" owner:nil options:nil] firstObject];
    return view;
}

- (void)awakeFromNib
{
    [super awakeFromNib];

    self.viewBannerSuper.backgroundColor = kCPSCRandomColor;
    
    
        
}

- (void)layoutSubviews
{
    [super layoutSubviews];


    if (!_advView) {
        
        [self.viewBannerSuper addSubview:self.advView];
        [self.advView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.right.bottom.mas_equalTo(0);
        }];
    
        self.advView.frame = self.viewBannerSuper.bounds;
        NSArray * arr = @[
    
            @"https://t7.baidu.com/it/u=4198287529,2774471735&fm=193&f=GIF",
            @"https://t7.baidu.com/it/u=1956604245,3662848045&fm=193&f=GIF",
            @"https://t7.baidu.com/it/u=2529476510,3041785782&fm=193&f=GIF"
        ];
        [self.advView configCellWithAdsArr:arr
                                  duration:2
                         isShowPageControl:YES
                                  adsClick:^(NSInteger index) {
    
    
        } scrollBlock:^(NSInteger index) {
        }];
    }
    
}



- (DGGCCycleAdView *)advView {
    if (!_advView) {
        _advView = [[DGGCCycleAdView alloc] init];
        _advView.layer.masksToBounds = YES;
        
//        [_advView addDarkMaskWithAlpha:0.16f];
        _advView.hidden = NO;
//        _advView.cycleView.placeholderImage = @"";

    }
    return _advView;
}

@end
